<?php
require_once ('odal/meta/simpleattribute.php');
require_once ('odal/meta/complexattribute.php');
require_once ('odal/node.php');
require_once ('odal/element.php');


/**
 * @version 1.0
 * @created 27-Dez-2003 21:35:24
 */
class odal_Scheme extends odal_Node
{

	var $m_complexAttributes = Array();
	var $m_namespaceId;
	var $m_namespace;
	var $m_parentSchemeId;
	var $m_simpleAttributes = Array();

	function odal_Scheme( &$namspace, $id, $parentSchemeId, $name, $creatingDate = null, $creater = 0, $modifyingDate = null, $modifier = 0 ){
		$this->_createScheme( $namspace, $id, $parentSchemeId, $name, $creatingDate, $creater, $modifyingDate, $modifier );
	}//odal_Scheme

	function _createScheme( &$namspace, $id, $parentSchemeId, $name, $creatingDate, $creater, $modifyingDate, $modifier ){
		$this->m_namespace =& $namspace;
		$this->m_id = $id;
		$this->m_parentSchemeId = $parentSchemeId;
		$this->m_name = $name;
		$this->m_creatingDate = $creatingDate;
		$this->m_creater = $creater;
		$this->m_modifyingDate = $modifyingDate;
		$this->m_modifier = $modifier;
	}//_createScheme

	function &getComplexAttributes(){
		return $this->m_complexAttributes;
	}//getComplexAttributes

	function &getComplexAttributeById( $id ){
		//echo "[scheme->getComplexAttributeById] id: " . $id . "<br>";
		$oCat =& $this->getObjectFromCollectionById( $id, $this->m_complexAttributes );
		//echo "[scheme->getComplexAttributeById] oCat->getName(): " . $oCat->getName() . "<br>";
		return $oCat; 
	}//getComplexAttributeById
	
	function &getComplexAttributeByName( $name ){
		return $this->getObjectFromCollectionByName( $name, $this->m_complexAttributes );
	}//getComplexAttributeByName

	function &getNamespace(){
		return $this->m_namespace;
	}//getNamespace

	function &getNamespaceId(){
		return $this->m_namespaceId;
	}//getNamespaceId

	function getParentSchemeId(){
		return $this->m_parentSchemeId;
	}//getParentSchemeId

	function &getSimpleAttributeById( $id ){
		return $this->getObjectFromCollectionById( $id, $this->m_simpleAttributes );
	}//getSimpleAttributeById

	function &getSimpleAttributeByName( $name ){
		//echo "[scheme->getSimpleAttributeByName] this->getName(): " . $this->getName() . " - given sat name: " . $name . "<br>\n";
		return $this->getObjectFromCollectionByName( $name, $this->m_simpleAttributes );
	}//getSimpleAttributeByNam
	
	function setNamespace( &$namespace ){
		$this->m_namespace =& $namespace;
		$this->m_namespaceId = $namespace->getId();
//		echo "[scheme->setNamespace] namespace->getId(): " . $namespace->getId() .  "<br>\n";
	}//setNamespace
	
	function setComplexAttributes( &$aComplexAttributes ){
		$this->m_complexAttributes =& $aComplexAttributes;
	}//setComplexAttributes
	
	function setSimpleAttributes( &$aSimpleAttributes ){
		$this->m_simpleAttributes =& $aSimpleAttributes;
	}//setSimpleAttributes

	function __sleep(){
		return array( "m_id", "m_name", "m_namespaceId", "m_complexAttributes", "m_parentSchemeId", "m_simpleAttributes" );
	}//__sleep

	function __TODO__(){}
	function createSimpleAttribute($ValueType, $Datatype_Id, $Schema_Id, $Name)
	{
	}

	function createComplexAttribute()
	{
	}

}//odal_Scheme
?>